From a6f20637872d79336150bb62c6ccbc384f4d7ff0 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Sat, 19 Dec 2015 12:44:34 -0700 Subject: [PATCH] Remove needless dylib check, add test In this case the dylib check isn't actually doing anything useful, as we're just appending search paths. Also adds a test for 8c65284b44337c6cfc003cedc8996e241ac678bd --- src/cargo/ops/cargo_rustc/mod.rs | 6 ----- tests/test_cargo_compile_custom_build.rs | 33 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 434faa20b..17bd36472 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -159,12 +159,6 @@ pub fn compile_targets<'a, 'cfg: 'a>(pkg_targets: &'a PackagesToBuild<'a>, if pkg == root_pkg { cx.compilation.cfgs.extend(output.cfgs.iter().cloned()); } - let any_dylib = output.library_links.iter().any(|l| { - !l.starts_with("static=") && !l.starts_with("framework=") - }); - if !any_dylib && !output.library_links.is_empty() { - continue - } for dir in output.library_paths.iter() { cx.compilation.native_dirs.insert(pkg.clone(), dir.clone()); } diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index 587185b4c..8c7357436 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -1789,3 +1789,36 @@ test!(rebuild_only_on_explicit_paths { ", running = RUNNING, compiling = COMPILING))); }); + +test!(doctest_recieves_build_link_args { + let p = project("foo") + .file("Cargo.toml", r#" + [project] + name = "foo" + version = "0.5.0" + authors = [] + [dependencies.a] + path = "a" + "#) + .file("src/lib.rs", "") + .file("a/Cargo.toml", r#" + [project] + name = "a" + version = "0.5.0" + authors = [] + links = "bar" + build = "build.rs" + "#) + .file("a/src/lib.rs", "") + .file("a/build.rs", r#" + fn main() { + println!("cargo:rustc-link-search=native=bar"); + } + "#); + + assert_that(p.cargo_process("test").arg("-v"), + execs().with_status(0) + .with_stdout_contains(&format!("\ +{running} `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]` +", running = RUNNING))); +}); -- 2.30.2